#include <iostream>

using namespace::std;

int main(int argc, char** argv)
{
    int array[10] = {3, 4, 6, 3, 8, -4, 14, 40, 9, 10};
    int size = sizeof(array)/sizeof(array[0]);
    int max_num, max_index, tmp;
    
    max_num = max_index = tmp = 0;
    for(int i = 0; i < size; i++)
    {
        max_num = array[i];
        max_index = i;
        for(int j = i+1; j < size; j++)
        {
            if(array[j] < max_num)
            {
               max_num = array[j];
               max_index = j;
            }
        }
        tmp = array[i];
        array[i] = array[max_index];
        array[max_index] = tmp;
    }

    for(int i = 0; i < size; i++)
    {
        cout << array[i] << " ";
    }
    cout << endl;

    return 0;
}
